package com.woniuxy.business.service.impl;

import com.woniuxy.business.mapper.BusinessInfoMapper;
import com.woniuxy.business.service.BusinessInfoService;
import com.woniuxy.entity.BusinessInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class BusinessInfoServiceImpl implements BusinessInfoService {
    @Resource
    private BusinessInfoMapper businessInfoMapper;

    //查询所有企业信息
    @Override
    public List<BusinessInfo> getAllBusinessInfo(String business_name,int pageIndex,int pageSize) {
        return businessInfoMapper.selectAllBusinessInfo(business_name,pageIndex,pageSize);
    }

    //添加企业信息
    @Override
    public void addBusinessInfo(BusinessInfo businessInfo) {
        businessInfoMapper.insertBusinessInfo(businessInfo);
    }

    //根据企业名字查找企业信息
    @Override
    public BusinessInfo getBusinessInfoByBusinessName(String business_name) {
        return businessInfoMapper.selectBusinessInfoByBusinessName(business_name);
    }

    //根据企业名字删除企业信息
    @Override
    public void removeBusinessInfo(String business_name) {
        businessInfoMapper.deleteBusinessInfo(business_name);
    }

    @Override
    public BusinessInfo selectBusinessInfoById(int id) {
       return businessInfoMapper.selectBusinessInfoById(id);
    }
}
